package com.lagou;

import com.lagou.bean.Resume;
import com.lagou.repository.ResumeRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class MongoRepositoryMain {
    public static void main(String[] args) {
        ApplicationContext applicationContext = SpringApplication.run(MongoRepositoryMain.class, args);
        ResumeRepository resumeRepository = applicationContext.getBean(ResumeRepository.class);
        System.out.println(resumeRepository.findAll().size());

        System.out.println(resumeRepository.findByNameEquals("liuqiang").size());
        System.out.println(resumeRepository.findByNameAndExpectSalary("liuqiang", 123).size());

        Resume resume = new Resume();
        resume.setName("liuqiang");
        resume.setExpectSalary(123);
        resume.setCity("sz");
        resumeRepository.insert(resume);
    }
}
